<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<h:head>
<link rel="stylesheet" type="text/css" href="#{facesContext.externalContext.requestContextPath}/template/css.css" media="all" />
<title>QueroTeto</title>

</h:head>
<h:body>
	<div id="corpo">
		<ui:include src="/template/topo.xhtml"/>
		<ui:include src="/template/menu.xhtml"/>
		
		<div id="conteudo">
			<div id="centro">		
				#{cadastroPropagandaBean.msg}
				<p:panel header="Cadastrar nova propaganda">
					<h:form id="form">

						<h:panelGrid columns="3" cellpadding="5">


							<h:outputText value="Assunto: " />
							<p:inputText value="#{cadastroPropagandaBean.propaganda.assunto}"
								required="true" id="assunto" />
							<p:message for="assunto" display="icon" />

							<h:outputText value="Banner: " />
							<p:inputText value="#{cadastroPropagandaBean.propaganda.banner}"
								required="true" id="banner" />
							<p:message for="banner" display="icon" />

							<h:outputText value="Descricao: " />
							<p:inputMask
								value="#{cadastroPropagandaBean.propaganda.descricao}"
								id="descricao" />
							<p:message for="descricao" display="icon" />

							<p:outputLabel for="email" value="Email: " />
							<p:inputText value="#{cadastroUsuarioBean.usuario.email}"
								required="true" id="email">
								<f:validateRegex
									pattern="^[_A-Za-z0-9-\+]+(\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\.[A-Za-z0-9]+)*(\.[A-Za-z]{2,})$" />
							</p:inputText>
							<p:message for="email" display="icon" />

							<h:outputText value="Link: " />
							<p:inputText value="#{cadastroPropagandaBean.propaganda.link}"
								required="true" id="link" />
							<p:message for="link" display="icon" />

							<h:outputText value="Responsavel: " />
							<p:inputText
								value="#{cadastroPropagandaBean.propaganda.responsavel}"
								required="true" id="responsavel" />
							<p:message for="responsavel" display="icon" />

							<p:outputLabel for="TelefoneFixo" value="Telefone: " />
							<p:inputMask value="#{cadastroPropagandaBean.propaganda.telefone}"
								mask="(99) 9999-9999" id="TelefoneFixo" />
							<p:message for="TelefoneFixo" display="icon" />

							<h:outputText id="cidade" value="Cidade: " for="cidade" />
							<p:selectOneMenu value="#{cadastroPropagandaBean.propaganda.cidade}" required="true">
								<f:selectItem itemLabel="--Selecione--" itemValue="" />
								<f:selectItem itemLabel="Quixadá" itemValue="Quixada" />
								<f:selectItem itemLabel="Iguatu" itemValue="Iguatu" />
								<f:selectItem itemLabel="Juazeiro" itemValue="Juazeiro" />
								<f:selectItem itemLabel="Quixeramobim" itemValue="Quixeramobim" />
								<f:selectItem itemLabel="Pacajus" itemValue="Pacajus" />
								<f:selectItem itemLabel="Crato" itemValue="Crato" />
								<f:selectItem itemLabel="Sobral" itemValue="Sobral" />
								<f:selectItem itemLabel="Fortaleza" itemValue="Fortaleza" />
								<f:selectItem itemLabel="Outro" itemValue="Outro" />

							</p:selectOneMenu>
							<p:message for="cidade" display="icon" />
							

							<h:outputText value="Tipo: " />
							<p:selectOneRadio id="tipo"
								value="#{cadastroPropagandaBean.propaganda.tipo}">
								<f:selectItem itemLabel="Banner Lateral" itemValue="1" />
								<f:selectItem itemLabel="Banner principal" itemValue="2" />
								<f:selectItem itemLabel="Slide" itemValue="3" />
							</p:selectOneRadio>
							<p:message for="tipo" display="icon" />

						</h:panelGrid>
						<p:commandButton value="Salvar" type="submit"
							action="#{cadastroPropagandaBean.cadastrar}" ajax="false" />
						<p:commandButton value="Cancelar" type="submit"	action="#{cadastroPropagandaBean.cancelar}" ajax="false" immediate="true" />
					</h:form>
				</p:panel>
			</div>	
			
		</div>
		<div id="both" align="center"></div>
		<ui:include src="/template/rodape.xhtml"/>
	</div>
</h:body>
</html>